package br.brpv.silvestrin.vendas.domain;

import android.os.Parcel;
import android.os.Parcelable;

public class Company implements Parcelable {
    private String id;
    private String codCompany;
    private String name;
    private String fantasyName;

    public Company(String id, String codCompany, String name, String fantasyName) {
        this.id = id;
        this.codCompany = codCompany;
        this.name = name;
        this.fantasyName = fantasyName;
    }

    public Company(Parcel in) {
        readFromParcel(in);
    }

    private void readFromParcel(Parcel in) {
        id = in.readString();
        codCompany = in.readString();
        name = in.readString();
        fantasyName = in.readString();
    }

    public String getId() {
        return id;
    }

    public String getCodCompany() {
        return codCompany;
    }

    public String getName() {
        return name;
    }

    public String getFantasyName() {
        return fantasyName;
    }

    @Override
    public String toString() {
        return fantasyName.substring(0,Math.min(30, fantasyName.length()));
    }

    @Override
    public int describeContents() {
        return 0;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(id);
        parcel.writeString(codCompany);
        parcel.writeString(name);
        parcel.writeString(fantasyName);
    }
}
